![]() |
PATH![]() |
![]() ![]() |
The following Menu Manager functions for manipulating and accessing menu item characteristics are new, changed, or not recommended with Appearance Manager 1.0:
Sets the value of the keyboard equivalent field of a menu item. When the Appearance Manager is available, you should call SetMenuItemModifiers , SetMenuItemHierarchicalID , and SetMenuItemTextEncoding instead of SetItemCmd to set a menu item's keyboard equivalent and text encoding and to indicate that a menu item has a submenu.
Not recommended with Appearance Manager 1.0 and later.
Sets a menu item's command ID.
pascal OSErr SetMenuItemCommandID (
MenuHandle inMenu,
SInt16 inItem,
UInt32 inCommandID);
You can use a menu item's command ID as a position-independent method of signalling a specific action in an application.
Obtains a menu item's command ID.
pascal OSErr GetMenuItemCommandID (
MenuHandle inMenu,
SInt16 inItem,
UInt32* outCommandID);
After a successful call to MenuSelect , MenuEvent , or MenuKey , call the GetMenuItemCommandID function to get a menu item's command ID. You can use a menu item's command ID as a position-independent method of signalling a specific action in an application.
Sets the font for a menu item.
pascal OSErr SetMenuItemFontID (
MenuHandle inMenu,
SInt16 inItem,
SInt16 inFontID);
The SetMenuItemFontID function enables you to set up a font menu with each item being drawn in the actual font.
Obtains a menu item's font ID.
pascal OSErr GetMenuItemFontID (
MenuHandle inMenu,
SInt16 inItem,
SInt16* outFontID);
Attaches a submenu to a menu item.
pascal OSErr SetMenuItemHierarchicalID (
MenuHandle inMenu,
SInt16 inItem,
SInt16 inHierID)
The SetMenuItemHierarchicalID function should be called instead of setting the keyboard equivalent to 0x1B. When the Appearance Manager is available, you should call SetMenuItemHierarchicalID instead of SetItemMark to set the menu ID of a menu item's submenu. However, you can still use SetItemMark to set the mark of a menu item.
Available with Appearance Manager 1.0 and later.
Setting a submenu with an menu ID greater than 255 is only supported under Mac OS 8.5 and later.
Obtains the menu ID of a specified submenu.
pascal OSErr GetMenuItemHierarchicalID (
MenuHandle inMenu,
SInt16 inItem,
SInt16 *outHierID)
Available with Appearance Manager 1.0 and later.
pascal OSErr SetMenuItemIconHandle (
MenuHandle inMenu,
SInt16 inItem,
UInt8 inIconType,
Handle inIconHandle);
The SetMenuItemIconHandle function sets the icon of a menu item with an icon handle instead of a resource ID. SetMenuItemIconHandle allows you to set icons of type 'ICON' , 'cicn' , 'SICN' , as well as icon suites. To set resource-based icons for a menu item, call SetItemIcon .
Disposing of the menu will not dispose of the icon handles set by this function. To prevent memory leaks, your application should dispose of the icons when you dispose of the menu.
Obtains a handle to a menu item's icon.
pascal OSErr GetMenuItemIconHandle (
MenuHandle inMenu,
SInt16 inItem,
UInt8* outIconType,
Handle* outIconHandle);
The GetMenuItemIconHandle function gets the icon handle and type of icon of the specified menu item. If you wish to get a resource-based menu item icon, call GetItemIcon .
Substitutes a keyboard glyph for the glyph normally displayed for a menu item's keyboard equivalent.
pascal OSErr SetMenuItemKeyGlyph (
MenuHandle inMenu,
SInt16 inItem,
SInt16 inGlyph)
The SetMenuItemKeyGlyph function overrides the character that would normally be displayed in a menu item's keyboard equivalent with a substitute keyboard glyph. This is useful if the keyboard glyph in the font doesn't match the actual character generated. For example, you might use this function to display function keys.
Obtains the keyboard glyph for a menu item's keyboard equivalent.
pascal OSErr GetMenuItemKeyGlyph (
MenuHandle inMenu,
SInt16 inItem,
SInt16 *outGlyph)
Sets the modifier key(s) that must be pressed with a character key to select a particular menu item.
pascal OSErr SetMenuItemModifiers (
MenuHandle inMenu,
SInt16 inItem,
UInt8 inModifiers);
You can call the SetMenuItemModifiers function to change the modifier key(s) you can include with a character key to create your keyboard equivalent. For example, you can change Command- x to Command-Option-Shift- x . By default, the Command key is always specified; however, you can remove the Command key by setting the kMenuNoCommand flag in the modifier keys field of an extended menu item entry in the 'xmnu' resource; see 'xmnu' .
Obtains the modifier keys that must be pressed with a character key to select a particular menu item.
pascal OSErr GetMenuItemModifiers (
MenuHandle inMenu,
SInt16 inItem,
UInt8* outModifiers);
Sets application-specific information for a menu item.
pascal OSErr SetMenuItemRefCon (
MenuHandle inMenu,
SInt16 inItem,
UInt32 inRefCon);
If you have any data you want to associate with a menu item, you can do so using the SetMenuItemRefCon function.
Obtains application-specific information for a menu item.
pascal OSErr GetMenuItemRefCon (
MenuHandle inMenu,
SInt16 inItem,
UInt32* outRefCon);
If you have assigned any data to a menu item using SetMenuItemRefCon function, you can read it using the GetMenuItemRefCon function.
Sets additional application-specific information for a menu item.
pascal OSErr SetMenuItemRefCon2 (
MenuHandle inMenu,
SInt16 inItem,
UInt32 inRefCon);
If you have data you want to associate with a menu item in addition to that set with the SetMenuItemRefCon function, you can do so using the SetMenuItemRefCon2 function.
Obtains application-specific information for a menu item.
pascal OSErr GetMenuItemRefCon2 (
MenuHandle inMenu,
SInt16 inItem,
UInt32* outRefCon);
If you have assigned any data to a given menu item using SetMenuItemRefCon2 function, you can read it using the GetMenuItemRefCon function.
Sets the text encoding for a menu item's text.
pascal OSErr SetMenuItemTextEncoding (
MenuHandle inMenu,
SInt16 inItem,
TextEncoding inScriptID);
To set the text encoding for a menu item's text, call the SetMenuItemTextEncoding function instead of SetItemCmd . If a menu item has a command code of 0x1C when SetMenuItemTextEncoding is called, the values in the command and icon fields of the menu resource are cleared and replaced with the value in the inScriptID parameter of SetMenuItemTextEncoding .
Obtains the text encoding used for a menu item's text.
pascal OSErr GetMenuItemTextEncoding (
MenuHandle inMenu,
SInt16 inItem,
TextEncoding* outScriptID);